package com.swt.gap.controller;

import com.swt.gap.common.graph.GraphNeo4jVO;
import com.swt.gap.model.vo.FlowVO;
import com.swt.gap.model.vo.graph.LiteLink;
import com.swt.gap.service.TransactionService;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * 请填写说明
 *
 * @author sx
 * @date 2020/7/3 10:55
 */
@Api(tags = "银行交易相关接口")
@RestController
@RequestMapping("/transaction")
public class TransactionController {

    private final TransactionService transactionService;

    public TransactionController(TransactionService transactionService) {
        this.transactionService = transactionService;
    }

    @ApiOperation(value = "交易类型")
    @ApiResponse(code = 200, message = "ok", response = String.class, responseContainer = "List")
    @PostMapping("/transaction-type")
    public ResponseEntity<Set<String>> listTransactionType(@RequestBody List<LiteLink> links) {
        return ResponseEntity.ok(transactionService.listTransactionType(links));
    }

    @ApiOperation(value = "流向分析")
    @ApiResponse(code = 200, message = "ok", response = String.class, responseContainer = "List")
    @PostMapping("/transaction-flow")
    public ResponseEntity<List<GraphNeo4jVO.Link>> expendByNodes(@RequestBody FlowVO record) {
        return ResponseEntity.ok(transactionService.listFlow(record));
    }

}
